var form, $,areaData;
layui.config({
    base : "../../js/"
}).extend({
    "address" : "address"
})
layui.use(['form','layer','upload','laydate',"address"],function(){
    form = layui.form;
    $ = layui.jquery;
    var layer = parent.layer === undefined ? layui.layer : top.layer,
        upload = layui.upload,
        laydate = layui.laydate,
        address = layui.address;


    //提交个人资料
    form.on("submit(changeUser)",function(data){
       // var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
        //将填写的用户信息存到session以便下次调取
        console.log($(".realName").val())
        var key,userInfoHtml = '';
        userInfoHtml = {
            'userid' : $(".userid").val(),
            'realname' : $(".realName").val(),
            'phone' : $(".phone").val(),
            'identity' : $(".identity").val(),
            'address' : $(".address").val(),
            'position' : $(".position").val()
        };
        url="/user/updateUserProfile"
        $.ajax({
                type:"post",
                url:url,
                timeout : 1000,
                async: false,
                data:userInfoHtml,
                success:function (msg) {
                    // console.log(1111)
                    layer.msg("提交成功！");
                    window.location.reload();
                }
            })
    })
    function reload() {
        $.ajax({
            url:"/sys/toUserMassege",
            type:"post",
            success:function () {
                layer.msg("刷新成功");
            }
        })
    }
    //修改密码
    // form.on("submit(changePwd)",function(data){
    //     var index = layer.msg('提交中，请稍候',{icon: 16,time:false,shade:0.8});
    //     setTimeout(function(){
    //         layer.close(index);
    //         layer.msg("密码修改成功！");
    //         $(".pwd").val('');
    //     },2000);
    //     return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
    // })
})